package com.xinhe.web.controller;

import com.querydsl.core.QueryResults;
import com.xinhe.web.annotation.WebUsed;
import com.xinhe.web.common.Result;
import com.xinhe.web.response.AssetDetailByManagerView;
import com.xinhe.web.response.AssetDetailByUserView;
import com.xinhe.web.service.AssetDetailCountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.Date;

@Api(value = "资产明细", tags = {"资产明细"})
@RestController
@RequestMapping(value = {"/assetDetailCount"}, produces = {"application/json;charset=UTF-8"})

public class AssetDetailCountController {
    @Autowired
    AssetDetailCountService assetDetailCountService;

    @WebUsed
    @ApiOperation(httpMethod = "POST", value = "分页查询(管理员)，即茶油卡明细、消费金红包明细、云茶籽明细")
    @RequestMapping({"/pageAssetDetailByManager"})
    public QueryResults<AssetDetailByManagerView> pageAssetDetailByManager(String queryWord, String assetType,String assetType1, String tradeType, Date startTime, Date endTime,
                                                                           int pageNum, int pageSize) {
        return assetDetailCountService.pageAssetDetailByManager(queryWord,  assetType,assetType1, tradeType, startTime,  endTime,
         pageNum,  pageSize);
    }

    @ApiOperation(httpMethod = "POST", value = "分页查询(用户)")
    @RequestMapping({"/pageAssetDetailByUser"})
    public QueryResults<AssetDetailByUserView> pageAssetDetailByUser(String queryWord, String assetType, String assetType1, String tradeType, Date startTime, Date endTime,
                                                                     int pageNum, int pageSize) {
        return assetDetailCountService.pageAssetDetailByUser(queryWord,  assetType,assetType1, tradeType, startTime,  endTime,
                pageNum,  pageSize);
    }

    @ApiOperation(httpMethod = "POST", value = "获取已解冻云茶籽")
    @RequestMapping({"/findByYunChaSend"})
    public Result findByYunChaSend() {
        return this.assetDetailCountService.findByYunChaSend();
    }

    @ApiOperation(httpMethod = "POST", value = "获取已兑换茶油")
    @RequestMapping({"/findByTeaOil"})
    public Result findByTeaOil() {
        return this.assetDetailCountService.findByTeaOil();
    }

    @ApiOperation(httpMethod = "POST", value = "获取总茶油卡")
    @RequestMapping({"/findByTeaOilCard"})
    public Result findByTeaOilCard() {
        return this.assetDetailCountService.findByTeaOilCard();
    }
}
